import { ESObjectsManager, ES3DTileset } from "earthsdk3";
import { provide, inject, ref } from "vue";
export function getobjm() {
    const objm = inject('objm');
    if (!objm) throw new Error('ESObjectsManager not found');
    return objm as ESObjectsManager;
}

export function getOrCreateSceneObj(objm: ESObjectsManager, sceneObjectType: string, id: string) {
    const sceneObject = objm.getSceneObject(id);
    if (sceneObject) return sceneObject;
    return objm.createSceneObject(sceneObjectType, id);
}

export function getSceneObj(objm: ESObjectsManager, id: String) {
    return objm.getSceneObject(id);
}

export function getPickedFeatureId() {
    const pickedId = inject('pickedFeatureId');
    return pickedId;
}

export function getPickedTilesetInfo() {
    const pickedTilesetInfo = inject("pickedTilesetInfo");
    return pickedTilesetInfo;
}

export function getSelectedBimModel() {
    const selectedBimModel = inject('bimModel');
    if (!selectedBimModel) return
    return selectedBimModel.value;
}